#ifndef __XKK_TCPSERVER_H__
#define __XKK_TCPSERVER_H__

#include "Acceptor.h"
#include "EventLoop.h"

namespace xkk
{

class TcpServer
{
public:
    TcpServer(const string &ip,unsigned short port);

    void start();

    void setConnectionCallback(TcpConnectionCallback &&cb)
    {  _loop.setConnectionCallback(std::move(cb));  }
    void setMessageCallback(TcpConnectionCallback &&cb)
    {  _loop.setMessageCallback(std::move(cb));  }
    void setCloseCallback(TcpConnectionCallback &&cb)
    {  _loop.setCloseCallback(std::move(cb));  }
private:
    Acceptor _acceptor;
    EventLoop _loop;
};

}//end of namespace xkk
#endif
